Skip to content

Conversation

@maxtara
Copy link
Collaborator

@maxtara maxtara commented Feb 10, 2026

Summary

Adds internal tools (registered via the Copilot SDK) to manage Cooper sessions. These tools allow the AI to create, list, and close session tabs directly.

Tools Added

  • cooper_create_session: Create a new session tab with optional cwd, model, and initial prompt. Defaults to current session's folder and model. Opens in background (doesn't switch tabs).
  • cooper_create_worktree_session: Create a git worktree and open a session in it. Validates that the path is a git repository. Use for parallel branch development.
  • cooper_list_sessions: List all active session tabs with their ID, model, cwd, and active status.
  • cooper_close_session: Close a session tab (cannot close the current session).
  • cooper_get_current_session: Get info about the current session.
  • cooper_get_models: List available AI models.
  • cooper_get_favorite_models: Get user's favorite models.

Why Internal Tools vs MCP

Based on prior exploration, internal tools (via Copilot SDK) are better than MCP for actions that touch UI state:

  • Tool responses flow through normal message handling - renderer reacts naturally via IPC events
  • No need for complex IPC → custom event → renderer listener chains
  • Tools run in main process with direct access to session state

Files Changed

  • \src/main/sessionTools.ts\ - New file with tool definitions
  • \src/main/main.ts\ - Integrate session tools into session creation
  • \src/preload/preload.ts\ - Add IPC event listeners for session creation/close
  • \src/renderer/App.tsx\ - Handle IPC events to create/close tabs in React state

Testing

  • All 394 tests pass
  • Build succeeds

- Add cooper_create_session: Create new session tab with optional cwd, model, initial prompt
- Add cooper_create_worktree_session: Create git worktree and open session in it
- Add cooper_list_sessions: List all active session tabs
- Add cooper_close_session: Close a session tab
- Add cooper_get_current_session: Get current session info
- Add cooper_get_models: List available AI models
- Add cooper_get_favorite_models: Get user's favorite models

New sessions open in background (don't switch away from current tab).
Worktree tool validates git repository before creating worktree.
@maxtara maxtara force-pushed the feature/session_tools branch from 97f1299 to 47541c9 Compare February 10, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant